package com.fernfx.xingtan.common;

import android.content.Context;
import android.support.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
import com.bumptech.glide.module.GlideModule;
import com.fernfx.xingtan.utils.GlideUtil;

/**
 * Created by admin on 2018/8/16.
 */

public class GlideCache implements GlideModule {
    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        //设置缓存目录(都可以自定义的)
        String downloadDirectoryPath = GlideUtil.ImageExternalCatchDir;

        builder.setDiskCache(new DiskLruCacheFactory(downloadDirectoryPath, GlideUtil.GLIDE_CATCH_SIZE));
    }

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {

    }
}
